package cn.sjlink.user.controller;

import cn.sjlink.user.service.UserService;
import cn.sjlink.util.RedisUtil;
import cn.sjlink.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin("*")
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private RedisUtil redisUtil;
    @Autowired
    private UserService userService;

    @RequestMapping(value = "getToken",method = RequestMethod.GET)
    public Result getToken(String stackId,String token){
        try {
            return userService.getToken(stackId,token);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,"授权登录失败");
        }
    }

}
